package com.zhike.b2b.task;

import java.io.PrintStream;
import java.util.Calendar;
import java.util.Timer;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.http.HttpServlet;

public class PublishPageByTimeListener extends HttpServlet
  implements ServletContextListener
{
  private static final long serialVersionUID = 7065236947173387428L;
  public static final int hours = 23;
  public static final int minutes = 59;
  public static final int seconds = 0;
  public static final long interval = 86400000L;
  private static Timer timer;

  public void contextDestroyed(ServletContextEvent paramServletContextEvent)
  {
    timer.cancel();
  }

  public void contextInitialized(ServletContextEvent paramServletContextEvent)
  {
    if (timer == null)
    {
      Calendar localCalendar = Calendar.getInstance();
      localCalendar.set(11, 23);
      localCalendar.set(12, 59);
      localCalendar.set(13, 0);
      timer = new Timer("PublishPageByTimeListener");
      timer.schedule(new PublishPageByTime(), localCalendar.getTime(), 86400000L);
    }
  }
}

